MC-10 Operation and Language Reference Manual Appendix A

Appendix A/Sample Programs Music Composer 10 INPUT "LENGTH(1-10)";M 20 M = M*4 30 INPUT "TEMPO (1-4)"; T1 40 IF T1 = 4 THEN 60 50 T = T1 : GOTO 70 60 T = 8 70 FOR K = 1 TO M*S 80 GOSUB 1000 90 B = RND(3) * T 100 SOUND P, B 110 CLS(S) 120 NEXT K 130 IF RND(10) <=8 THEN 150 140 SOUND 125, 16*T 145 END 150 SOUND 90, 16*T 160 END 1000 X = RND(100) 1010 IF X <= 20 AND X <= 25 THEN P = 90 : S = 1 1020 IF X > 21 AND X <= 25 THEN P = 108 : S = 2 1030 IF X > 25 AND X <= 40 THEN P = 125 : S = 3 1040 IF X > 40 AND X <= 55 THEN P = 133 : S = 4 1050 IF X > 55 AND X <= 75 THEN P = 147 : S = 5 1060 IF X > 75 AND X <= 85 THEN P = 159 : S = 6 1070 IF X > 85 AND X <= 95 THEN P = 176 : S = 7 1080 IF X > 95 THEN P = 58 : S = 8 1090 RETURN Crap Game 10 CLS 20 A = RND(6) 30 B = RND(6) 40 R = A + B 50 PRINT @ 200, A 60 PRINT @ 214, B 70 PRINT @ 394, "YOU ROLLED A"; R 80 IF R = 2 THEN 500 90 IF R = 3 THEN 500 100 IF R = 12 THEN 500 110 IF R = 7 THEN 600 120 IF R = 11 THEN 600 130 FOR X = 1 TO 800 140 NEXT X 150 CLS 160 PRINT @ 195, "ROLL ANOTHER" R "AND YOU WIN" 170 PRINT @ 262, "ROLL A 7 AND YOU LOSE" 180 PRINT @ 420, "PRESS <ENTER> WHEN READY" 185 PRINT @ 456, "FOR YOUR NEXT ROLL" 190 INPUT A$ 200 X = RND(6) 210 Y = RND(6) 220 Z = X + Y 225 CLS 230 PRINT @ 200, X 240 PRINT @ 214, Y 250 PRINT @ 394, "YOU ROLLED A"; Z 260 IF Z = R THEN 500 270 IF Z = 7 THEN 600 280 GOTO 100 500 FOR X = 1 TO 1000 510 NEXT X 515 CLS 520 PRINT @ 230, "YOU'RE THE WINNER" 530 PRINT @ 294, "CONGRATULATIONS!!!" 540 GOTO 630 600 FOR X = 1 TO 1000 610 NEXT X 615 CLS 620 PRINT @ 264, "SORRY YOU LOSE" 630 PRINT @ 458, "GAME'S OVER" Table of Squares 5 CLS 7 PRINT @ 38, "TABLE OF SQUARES" 8 PRINT 10 P = 2 20 FOR N = 2 TO 10 25 GOSUB 2000 30 PRINT N "*" N "=" E, 40 NEXT N 50 END 2000 REM FORMULA FOR RAISING A NUMBER TO A POWER 2010 E = 1 2020 FOR X = 1 TO P 2030 E = E * N 2040 NEXT X 2050 IF P = 0 THEN E = 1 2060 RETURN Computing Interest Earnings for a Savings Account 10 INPUT "YOUR MONTHLY DEPOSIT";D 20 INPUT "BANK'S ANNUAL INTEREST RATE";I 30 I = I/12 * .01 40 INPUT "NUMBER OF DEPOSITS";P 50 GOSUB 1000 60 PRINT "YOU WILL HAVE $" FV " IN " P " MONTHS" 70 END 1000 REM: COMPOUND MONTHLY INTEREST FORMULA 1010 N = I + 1 1020 GOSUB 2000 1030 FV = D * ((E-1)/I) 1040 RETURN 2000 REM: FORMULA FOR RAISING A NUMBER TO A POWER 2010 E = 1 2020 FOR X = 1 TO P 2030 E = E * N 2040 NEXT X 2050 IF P = 0 THEN E = 1 2060 RETURN Kaleidoscope 10 CLS0 20 X=RND(32)-1 30 Y=RND(16)-1 40 Z=RND(9)-1 50 GOSUB90 60 GOTO 20 90 IFZ=0 OR RND(7)=3THEN150 100 SET(31-X,16+Y,Z) 110 SET(31-X,15-Y,Z) 120 SET(32+X,16+Y,Z) 130 SET(32+X,15-Y,Z) 140 RETURN 150 RESET(31-X,16+Y) 160 RESET(31-X,15-Y) 170 RESET(32+X,16+Y) 180 RESET(32+X,15-Y) 190 RETURN

Comments should be directed to the following email address:
dsbrain@neosplice.com